-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Fix Python 3.12+ fork warning in async Task SDK connection tests #56019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolves intermittent test failure where `asgiref.sync.sync_to_async` creates ThreadPoolExecutors that persist between tests, causing Python 3.12+ to warn about forking multi-threaded processes when supervisor.py calls `os.fork()`. Added targeted cleanup of asgiref executors after async tests to ensure clean thread environment for subsequent tests that use `fork()`. Example failure: https://github.com/apache/airflow/actions/runs/17957802850/job/51079451184#step:9:696
|
Failures are due to docker rate limit:
|
amoghrajesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a strange one! Was it introduced "now" due to some dependency bump or it was just a matter of fact till we eventually hit it?
(cherry picked from commit 8e6f03e)
We encountered an intermittent test failure on Python 3.12 only in the Task SDK: https://github.com/apache/airflow/actions/runs/17957802850/job/51079451184#step:9:696 and marked that test as
XFAIL: 6d2aac6Failed Test: `
Example failure: https://github.com/apache/airflow/actions/runs/17957802850/job/51079451184#step:9:696
Root Cause Analysis
The Threading Issue
Python 3.12 introduced a
DeprecationWarningwhenos.fork()is called in a multi-threaded process.Code Path Investigation
Through systematic analysis, we discovered:
asgiref.sync.sync_to_asynccreates persistentThreadPoolExecutorthreadstask-sdk/src/airflow/sdk/execution_time/context.py:217Testing Instructions for Reviewers:
Example run:
I do not want to admit how much time I & @jedcunningham spent on debugging this frustratingly :)
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.